$(function () {

    //初始化表格
    initTable();
});


function initTable() {
    var options = {
        url: prefix + "/list",
        createUrl: prefix + "/addInit",
        updateUrl: prefix + "/editInit/{id}",
        removeUrl: prefix + "/remove",
        sortName: "createTime",
        sortOrder: "desc",
        modalName: "用户",
        search: false,
        showExport: false,
        columns: [{
            checkbox: true
        },{
            field: 'userId',
            title: '用户编号'
        },{
            field: 'loginName',
            title: '登录名',
            sortable: true
        },{
            field: 'userName',
            title: '用户名',
            sortable: true
        },{
            field: 'sex',
            title: '性别',
            sortable: true,
            align: 'center',
            formatter: function (value, row, index) {
                return $.table.selectDictValue(sexDatas, value);
            }
        },{
            field: 'birthday',
            title: '出生日期',
            sortable: true
        },{
            field: 'phone',
            title: '手机号码',
            sortable: true
        },{
            field: 'address',
            title: '地址'
        },{
            field: 'email',
            title: '邮箱'
        },{
            field: 'status',
            title: '状态',
            sortable: true,
            formatter: function (value, row, index) {
                return $.table.selectDictValue(statusDatas, value);
            }
        },{
            field: 'createTime',
            title: '创建时间',
            sortable: true
        },{
            title: '操作',
            align: 'center',
            formatter: function(value, row, index) {
                var actions = [];
                actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.editFull(\'' + row.userId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.userId + '\')"><i class="fa fa-remove"></i>删除</a>');
                return actions.join('');
            }
        }]
    }
    $.table.init(options);
}
